﻿using System;
using System.Linq;
using WebExam.DataEntities;

namespace WebExam.DataProvider
{
    public interface IXSRepository
    {
        /// <summary>
        /// 根据学号获取学生信息
        /// </summary>
        /// <param name="xsId">学号</param>
        XS Get(string xsId);

        /// <summary>
        /// 根据证件号获取学生信息
        /// </summary>
        /// <param name="idCard">证件号</param>
        XS GetByIdcard(string idCard);

        /// <summary>
        /// 根据班级Id获取学生信息
        /// </summary>
        /// <param name="bjId">班级Id</param>
        /// <param name="start">开始位置</param>
        /// <param name="takeSize">获取记录条数</param>
        IQueryable<XS> GetAll(int bjId, int start, int takeSize);

        /// <summary>
        /// 添加学生信息
        /// </summary>
        /// <param name="xs">学生对象</param>
        XS Add(XS xs);

        /// <summary>
        /// 更新学生信息
        /// </summary>
        /// <param name="xsId">学号</param>
        /// <param name="update">包含更新操作的方法</param>
        XS Update(string xsId, Action<XS> update);

        /// <summary>
        /// 删除学生
        /// </summary>
        /// <param name="xsId">学号</param>
        bool Delete(string xsId);

        /// <summary>
        /// 根据班级Id统计班级个数
        /// </summary>
        /// <param name="bjId">班级Id</param>
        int Count(int bjId);
    }
}